<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of adaptimadj</title>
  <meta name="keywords" content="adaptimadj">
  <meta name="description" content="ADAPTIMADJ adaptively adjusts the intensity of an image">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../../m2html.css">
  <script type="text/javascript">
    if (top.frames.length == 0) { top.location = "../../index.html"; };
  </script>
</head>
<body>
<a name="_top"></a>
<!-- # RADOCCToolbox --><!-- menu.html CornerFinder -->
<h1>adaptimadj
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>ADAPTIMADJ adaptively adjusts the intensity of an image</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="box"><strong>function imgout=adaptimadj(img,win,th) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre class="comment"> ADAPTIMADJ adaptively adjusts the intensity of an image</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="adaptstats.html" class="code" title="function [mimg,stdv]=adaptstats(img,win)">adaptstats</a>	ADAPTSTATS gets the local mean and standard deviations for each pixel in the image within a region.</li></ul>
This function is called by:
<ul style="list-style-image:url(../../matlabicon.gif)">
<li><a href="findcorners.html" class="code" title="function imgcout=findcorners(img,debug)">findcorners</a>	FINDCORNERS is the main function called by the calibration GUI.</li></ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function imgout=adaptimadj(img,win,th)</a>
0002 <span class="comment">% ADAPTIMADJ adaptively adjusts the intensity of an image</span>
0003 
0004 <span class="comment">% ADAPTIMADJ adaptively adjusts the intensity of the input image. The</span>
0005 <span class="comment">% adjustment is performed according to the mean and standard deviation of</span>
0006 <span class="comment">% the region around each pixel.</span>
0007 <span class="comment">%</span>
0008 <span class="comment">% USAGE:</span>
0009 <span class="comment">%     imgout=adaptimadj(img); default window size is min(size(img))/5,</span>
0010 <span class="comment">%     default th is 1.</span>
0011 <span class="comment">%</span>
0012 <span class="comment">% INPUTS:</span>
0013 <span class="comment">%     img: grayscale double image</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%     win: size of the rectangular region to inspect at each pixel</span>
0016 <span class="comment">%</span>
0017 <span class="comment">%     th: parameters that tunes the degree of adjustment</span>
0018 <span class="comment">%</span>
0019 <span class="comment">% OUTPUTS:</span>
0020 <span class="comment">%     imgout: adjusted image</span>
0021 
0022 <span class="comment">% check input</span>
0023 <span class="keyword">if</span> nargin&lt;2 || isempty(win);
0024     win=round(min(size(img))/5);
0025 <span class="keyword">end</span>
0026 <span class="keyword">if</span> nargin&lt;3 || isempty(th)
0027     th=1;
0028 <span class="keyword">end</span>
0029 
0030 
0031 [mimg,stdv]=<a href="adaptstats.html" class="code" title="function [mimg,stdv]=adaptstats(img,win)">adaptstats</a>(img,win);
0032 
0033 imax=mimg+th*stdv;
0034 imin=mimg-th*stdv;
0035 
0036 <span class="comment">% clip</span>
0037 imax(imax&gt;1)=1;
0038 imin(imin&lt;0)=0;
0039 
0040 imgout=(img-imin)./(imax-imin);
0041 
0042 <span class="comment">% adjust for clipping and saturation</span>
0043 imgout(imgout&gt;1)=1;
0044 imgout(imgout&lt;0)=0;</pre></div>
<hr><address>Generated on Sun 04-Apr-2010 17:13:59 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
</body>
</html>